package com.annotation.aop;


import lombok.extern.slf4j.Slf4j;
import org.aspectj.lang.JoinPoint;
import org.aspectj.lang.annotation.After;
import org.aspectj.lang.annotation.Aspect;
import org.aspectj.lang.annotation.Before;
import org.aspectj.lang.annotation.Pointcut;
import org.springframework.stereotype.Component;

@Component
@Aspect
@Slf4j
public class MyLogAspect {

    @Pointcut("@annotation(com.annotation.aop.MyLog)")
    public void myLogPointcut() {

    }

    @Before(value = "myLogPointcut()", argNames = "joinPoint")
    public void before(JoinPoint joinPoint) {
        log.info("before method start");

    }

    @After(value = "myLogPointcut()", argNames = "joinPoint")
    public void after(JoinPoint joinPoint) {
        log.info("after method end");
    }
}
